package online.flowerinsnow.minecraft.bukkit.manhunt.event;

import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.jetbrains.annotations.NotNull;

public class PlayerAttackEvent extends Event implements Cancellable {
    public static final HandlerList handlerList = new HandlerList();
    private final EntityDamageByEntityEvent caused;
    public final Player player;
    public final Entity entity;
    public double showedDamage;

    public PlayerAttackEvent(Player player, EntityDamageByEntityEvent caused) {
        this.caused = caused;
        this.player = player;
        this.entity = caused.getEntity();
        this.showedDamage = caused.getFinalDamage();
    }

    @Override
    public @NotNull HandlerList getHandlers() {
        return handlerList;
    }
    public static HandlerList getHandlerList() {
        return handlerList;
    }
    public double getDamage() {
        return caused.getDamage();
    }
    public PlayerAttackEvent setDamage(double damage) {
        caused.setDamage(damage);
        return this;
    }
    public double getFinalDamage() {
        return caused.getFinalDamage();
    }

    @Override
    public boolean isCancelled() {
        return caused.isCancelled();
    }

    @Override
    public void setCancelled(boolean b) {
        caused.setCancelled(b);
    }
}
